﻿using System;

using TrivialPurfuit.Data;

namespace TrivialPurfuit.Business
{
    public class QuestionCard : BindableObject
    {
        private Data.TPDataSet.QuestionRow _questionRow;

        public QuestionCard(Data.TPDataSet.QuestionRow qRow)
        {
            this._questionRow = qRow;

        }

        public QuestionCard()
        {
            this._questionRow = Data.QuestionData.Instance.Question.NewQuestionRow();

            this._questionRow.id = QuestionData.Instance.getNextID("Question");
            this._questionRow.categoryID = CategoryCON.NULL.ID;
            this._questionRow.question = "";
            this._questionRow.answer = "";

            Data.QuestionData.Instance.Question.AddQuestionRow(this._questionRow);
        }

        public int ID
        {
            get
            {
                return _questionRow.id;
            }
        }

        public int CategoryID
        {
            get
            {
                return _questionRow.categoryID;
            }
            set
            {
                this._questionRow.categoryID = value;
                this.RaisePropertyChanged("CategoryName");
                this.RaisePropertyChanged("CategoryColor");
            }
        }

        public string CategoryName
        {
            get
            {
                return this._questionRow.CategoryRow.name;
            }
        }

        public string CategoryColor
        {
            get
            {
                return this._questionRow.CategoryRow.color;
            }
        }

        public string Question
        {
            get
            {
                return _questionRow.question;
            }
            set
            {
                this._questionRow.question = value;
            }
        }

        public string Answer
        {
            get
            {
                return _questionRow.answer;
            }
            set
            {
                this._questionRow.answer = value;
            }
        }
    }
}
